
package Vistas;

import ConexionBD.UsuarioBd;
import ConexionBD.VehiculoBD;
import ConexionBD.VerificaServidor;
import ConexionBD.mysql;
import Usuario.Usuario;
import java.awt.Color;
import javax.swing.JFrame;
import javax.swing.JOptionPane;


public class AdministrarUsuario extends javax.swing.JDialog {

        mysql conexion = new mysql();
        UsuarioBd AdmUsuario = new UsuarioBd();
        VehiculoBD AdmVehiculo = new VehiculoBD() ;
        VerificaServidor servidor = new VerificaServidor();
        String cedula;
    
    public AdministrarUsuario(String estatus,String ci) {
        initComponents();
        setVisible(true);
        String valor = estatus;
        cedula = ci;
        pack();
        
        FechaSistema();
        
        if(valor.equals("modificar")){
            this.CrearUsuario.setEnabled(false);
            this.eliminarusuario.setEnabled(false);
            setTitle("MODIFICAR USUARIO");
            this.jPanel1.setEnabled(false);
            Usuario  Nusuario = AdmUsuario.ObtieneUsuario(conexion.getConexionLocal(), cedula);
            this.Muestrausuario(Nusuario);
                   
        }
        
        if (valor.equals("crear")){
            setTitle("CREAR NUEVO USUARIO");
            this.ModificarUsuario.setEnabled(false);
            this.eliminarusuario.setEnabled(false);
        }
        
        if(valor.equals("eliminar")){
            setTitle("ELEMINAR  USUARIO");
            this.ModificarUsuario.setEnabled(false);
            this.CrearUsuario.setEnabled(false);  
            Usuario  Nusuario = AdmUsuario.ObtieneUsuario(conexion.getConexionLocal(), cedula);       
            this.Muestrausuario(Nusuario);
                     
        }
        
        
    }

   
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jPanel1 = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();
        capturanombre = new javax.swing.JTextField();
        capturaapellido = new javax.swing.JTextField();
        capturalogin = new javax.swing.JTextField();
        capturaclave = new javax.swing.JTextField();
        capturaNcarros = new javax.swing.JTextField();
        jLabel6 = new javax.swing.JLabel();
        capturacedula = new javax.swing.JTextField();
        jLabel7 = new javax.swing.JLabel();
        capturaIdUsuario = new javax.swing.JTextField();
        CrearUsuario = new javax.swing.JButton();
        LimpiaJTextField = new javax.swing.JButton();
        ModificarUsuario = new javax.swing.JButton();
        eliminarusuario = new javax.swing.JButton();
        mensajeImportante = new javax.swing.JLabel();
        fechaActual = new javax.swing.JLabel();
        jLabel8 = new javax.swing.JLabel();
        jLabel9 = new javax.swing.JLabel();
        muestraHora = new javax.swing.JLabel();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);

        jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "NUEVO USUARIO", javax.swing.border.TitledBorder.CENTER, javax.swing.border.TitledBorder.DEFAULT_POSITION));

        jLabel1.setText("Nombre:");

        jLabel2.setText("Apellido:");

        jLabel3.setText("Login:");

        jLabel4.setText("Clave:");

        jLabel5.setText("NCarros:");

        capturanombre.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                capturanombreMouseClicked(evt);
            }
        });

        capturaapellido.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                capturaapellidoMouseClicked(evt);
            }
        });
        capturaapellido.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                capturaapellidoActionPerformed(evt);
            }
        });

        capturalogin.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                capturaloginMouseClicked(evt);
            }
        });

        capturaclave.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                capturaclaveMouseClicked(evt);
            }
        });

        capturaNcarros.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                capturaNcarrosMouseClicked(evt);
            }
        });

        jLabel6.setText("Cedula");

        capturacedula.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                capturacedulaMouseClicked(evt);
            }
        });

        jLabel7.setText("IdUsua:");

        capturaIdUsuario.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                capturaIdUsuarioMouseClicked(evt);
            }
        });
        capturaIdUsuario.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                capturaIdUsuarioActionPerformed(evt);
            }
        });

        CrearUsuario.setText("CREAR");
        CrearUsuario.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                CrearUsuarioActionPerformed(evt);
            }
        });

        LimpiaJTextField.setText("LIMPIAR");
        LimpiaJTextField.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                LimpiaJTextFieldActionPerformed(evt);
            }
        });

        ModificarUsuario.setText("MODIFICAR");
        ModificarUsuario.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                ModificarUsuarioActionPerformed(evt);
            }
        });

        eliminarusuario.setText("ELIMINAR");
        eliminarusuario.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                eliminarusuarioActionPerformed(evt);
            }
        });

        mensajeImportante.setForeground(new java.awt.Color(53, 83, 51));

        jLabel8.setText("Fecha:");

        jLabel9.setText("Hora:");

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanel1Layout.createSequentialGroup()
                                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(jLabel1)
                                    .addComponent(jLabel2)
                                    .addComponent(jLabel3)
                                    .addComponent(jLabel4)
                                    .addComponent(jLabel5))
                                .addGap(4, 4, 4)
                                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                    .addComponent(capturanombre)
                                    .addComponent(capturaapellido)
                                    .addComponent(capturalogin)
                                    .addComponent(capturaclave)
                                    .addComponent(capturaNcarros, javax.swing.GroupLayout.DEFAULT_SIZE, 139, Short.MAX_VALUE))
                                .addGap(26, 26, 26))
                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
                                .addComponent(CrearUsuario)
                                .addGap(40, 40, 40)
                                .addComponent(ModificarUsuario)
                                .addGap(44, 44, 44))
                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
                                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                    .addComponent(jLabel9)
                                    .addComponent(jLabel8))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                    .addComponent(fechaActual, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                    .addComponent(muestraHora, javax.swing.GroupLayout.DEFAULT_SIZE, 230, Short.MAX_VALUE))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)))
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanel1Layout.createSequentialGroup()
                                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(jLabel6)
                                    .addComponent(jLabel7))
                                .addGap(3, 3, 3)
                                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(capturacedula, javax.swing.GroupLayout.PREFERRED_SIZE, 127, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(capturaIdUsuario, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE)))
                            .addGroup(jPanel1Layout.createSequentialGroup()
                                .addGap(94, 94, 94)
                                .addComponent(LimpiaJTextField))))
                    .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                        .addComponent(eliminarusuario)
                        .addComponent(mensajeImportante, javax.swing.GroupLayout.PREFERRED_SIZE, 353, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel1)
                    .addComponent(capturanombre, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel6)
                    .addComponent(capturacedula, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(19, 19, 19)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel2)
                    .addComponent(capturaapellido, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel7)
                    .addComponent(capturaIdUsuario, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel3)
                    .addComponent(capturalogin, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel4)
                    .addComponent(capturaclave, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(8, 8, 8)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jLabel5)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addComponent(capturaNcarros, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(2, 2, 2)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(mensajeImportante, javax.swing.GroupLayout.DEFAULT_SIZE, 27, Short.MAX_VALUE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(CrearUsuario)
                    .addComponent(ModificarUsuario)
                    .addComponent(eliminarusuario)
                    .addComponent(LimpiaJTextField))
                .addGap(18, 18, 18)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jLabel8)
                    .addComponent(fechaActual, javax.swing.GroupLayout.PREFERRED_SIZE, 19, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel9)
                    .addComponent(muestraHora, javax.swing.GroupLayout.PREFERRED_SIZE, 17, javax.swing.GroupLayout.PREFERRED_SIZE)))
        );

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(38, 38, 38)
                .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(21, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(39, 39, 39)
                .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void capturaapellidoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_capturaapellidoActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_capturaapellidoActionPerformed

    private void capturaIdUsuarioActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_capturaIdUsuarioActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_capturaIdUsuarioActionPerformed

    private void CrearUsuarioActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_CrearUsuarioActionPerformed

     Usuario  Nusuario = InstanciaUsuario();
        
 JOptionPane.showMessageDialog(null,Nusuario.getNombre() + ","+ Nusuario.getApellido() +"," + Nusuario.getCI()+","
 + Nusuario.getlogin()+ "," + Nusuario.getClave()+ "," + Nusuario.getNcarros()+"," + Nusuario.getidUsuario());
            
        if(servidor.VerificaLocal()){
        int opcion = JOptionPane.showConfirmDialog(null, "A continuación ingresaremos un Usuario nuevo\n¿Está seguro?","Agregar Usuario", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE);
          if(opcion == 0){
              
            this.CrearUsuario.setSelected(false);          
            AdmUsuario.InsertaUsuario(conexion.getConexionLocal(),Nusuario);
            /* Aqui primero se cargan los datos del vehiculo y luego se adminstran */
            
            int ncarro = Integer.parseInt(this.capturaNcarros.getText());
            
            while(ncarro != 0){
            AdminstrarVehiculo Nvehiculo = new AdminstrarVehiculo("crear",Nusuario.getCI(),ncarro);
            Nvehiculo.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
            Nvehiculo.setLocationRelativeTo(null);
            ncarro--;
            }
            
          } else
              if(opcion == 1){
               this.CrearUsuario.setSelected(true);
               
              }
        }
        
        /* Antes de ingresar a la pagina de administracion vehicular verificar que se hallan cargados
         * los datos del Vehiculo
         */
        
         int opcion2 = JOptionPane.showConfirmDialog(null, "Desea Ingresar a la Pagina de Configuracion Vehicular\n¿Está seguro?","Gestion Vehicular", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE);
         if(opcion2 == 0){
             
           Gestionvehiculo ventana = new Gestionvehiculo(Nusuario.getCI());
           ventana.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
           ventana.setLocationRelativeTo(null);
           
         } else if(opcion2 == 1){
             setVisible(true);
         }
         
         // TODO add your handling code here:
    }//GEN-LAST:event_CrearUsuarioActionPerformed

    private void LimpiaJTextFieldActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_LimpiaJTextFieldActionPerformed
        this.limpiaJtextFiel();            
        // TODO add your handling code here:
    }//GEN-LAST:event_LimpiaJTextFieldActionPerformed

    private void capturanombreMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_capturanombreMouseClicked
        this.capturanombre.setFocusable(true);
        this.capturanombre.setBackground(Color.GREEN);
        // TODO add your handling code here:
    }//GEN-LAST:event_capturanombreMouseClicked

    private void capturaapellidoMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_capturaapellidoMouseClicked
        this.capturaapellido.setBackground(Color.GREEN);
        // TODO add your handling code here:
    }//GEN-LAST:event_capturaapellidoMouseClicked

    private void capturaloginMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_capturaloginMouseClicked
       this.capturalogin.setBackground(Color.GREEN);
        // TODO add your handling code here:
    }//GEN-LAST:event_capturaloginMouseClicked

    private void capturaclaveMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_capturaclaveMouseClicked
        this.capturaclave.setBackground(Color.GREEN);
        // TODO add your handling code here:
    }//GEN-LAST:event_capturaclaveMouseClicked

    private void capturaNcarrosMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_capturaNcarrosMouseClicked
      this.capturaNcarros.setBackground(Color.GREEN);
        // TODO add your handling code here:
    }//GEN-LAST:event_capturaNcarrosMouseClicked

    private void capturacedulaMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_capturacedulaMouseClicked
        this.capturacedula.setBackground(Color.GREEN);
        // TODO add your handling code here:
    }//GEN-LAST:event_capturacedulaMouseClicked

    private void capturaIdUsuarioMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_capturaIdUsuarioMouseClicked
       this.capturaIdUsuario.setBackground(Color.GREEN);
        // TODO add your handling code here:
    }//GEN-LAST:event_capturaIdUsuarioMouseClicked

    private void ModificarUsuarioActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ModificarUsuarioActionPerformed

     Usuario  Nusuario = InstanciaUsuario();   
     AdmUsuario.ActualizaUsuario(conexion.getConexionLocal(), Nusuario);
        
         
        // TODO add your handling code here:
    }//GEN-LAST:event_ModificarUsuarioActionPerformed

    private void eliminarusuarioActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_eliminarusuarioActionPerformed

            int opcion = JOptionPane.showConfirmDialog(null, "A continuación Se eliminara un Cuenta nuevo\n¿Está seguro?","Eliminar Usuario", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE);
            
            if(opcion == 0){
              
            AdmUsuario.EliminaUsuario(conexion.getConexionLocal(), cedula);
            this.limpiaJtextFiel();
            this.mensajeImportante.setText("Su Cuenta Fue Eliminada: " + cedula);
            
            }
            
            else if(opcion == 1){
                this.mensajeImportante.setText("Su Cuenta no Fue Eliminada: " + cedula);
            }
            
        // TODO add your handling code here:
    }//GEN-LAST:event_eliminarusuarioActionPerformed

  
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton CrearUsuario;
    private javax.swing.JButton LimpiaJTextField;
    private javax.swing.JButton ModificarUsuario;
    private javax.swing.JTextField capturaIdUsuario;
    private javax.swing.JTextField capturaNcarros;
    private javax.swing.JTextField capturaapellido;
    private javax.swing.JTextField capturacedula;
    private javax.swing.JTextField capturaclave;
    private javax.swing.JTextField capturalogin;
    private javax.swing.JTextField capturanombre;
    private javax.swing.JButton eliminarusuario;
    private javax.swing.JLabel fechaActual;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JLabel mensajeImportante;
    private javax.swing.JLabel muestraHora;
    // End of variables declaration//GEN-END:variables

 public Usuario InstanciaUsuario(){
        String Nombre,Apellido,login,clave, CIUsuario;
        int ncarros, idUsuario;

        Nombre = this.capturanombre.getText();
        Apellido = this.capturaapellido.getText();
        login = this.capturalogin.getText();
        clave = this.capturaclave.getText();
        CIUsuario = this.capturacedula.getText();
        ncarros = Integer.parseInt(this.capturaNcarros.getText());
        idUsuario = Integer.parseInt(this.capturaIdUsuario.getText());
        
        Usuario Miusuario = new Usuario(Nombre,Apellido,CIUsuario,login,clave,ncarros,idUsuario);

        return Miusuario;

    }

 
 public void limpiaJtextFiel(){
     
            this.capturaIdUsuario.setText(null);
            this.capturaIdUsuario.setBackground(Color.WHITE);
            this.capturaNcarros.setText(null);
            this.capturaNcarros.setBackground(Color.WHITE);
            this.capturaapellido.setText(null);
            this.capturaapellido.setBackground(Color.WHITE);
            this.capturanombre.setText(null);
            this.capturanombre.setBackground(Color.WHITE);
            this.capturacedula.setText(null);
            this.capturacedula.setBackground(Color.WHITE);
            this.capturaclave.setText(null);
            this.capturaclave.setBackground(Color.WHITE);
            this.capturalogin.setText(null);
            this.capturalogin.setBackground(Color.WHITE);
     
 }

 public final void Muestrausuario(Usuario Nusuario){
            
            this.capturaIdUsuario.setText(String.valueOf(Nusuario.getidUsuario()));
            this.capturaIdUsuario.setBackground(Color.LIGHT_GRAY);
            this.capturaNcarros.setText(String.valueOf(Nusuario.getNcarros()));
            this.capturaNcarros.setBackground(Color.LIGHT_GRAY);
            this.capturaapellido.setText(Nusuario.getApellido());
            this.capturaapellido.setBackground(Color.LIGHT_GRAY);
            this.capturanombre.setText(Nusuario.getNombre());
            this.capturanombre.setBackground(Color.LIGHT_GRAY);
            this.capturacedula.setText(Nusuario.getCI());
            this.capturacedula.setBackground(Color.YELLOW);
            this.capturaclave.setText(Nusuario.getClave());
            this.capturaclave.setBackground(Color.LIGHT_GRAY);
            this.capturalogin.setText(Nusuario.getlogin());
            this.capturalogin.setBackground(Color.LIGHT_GRAY);
            
 }
 
 public final void FechaSistema(){
     
        java.util.Date utilDate = new java.util.Date(); //fecha actual
        long lnMilisegundos = utilDate.getTime();
        java.sql.Date sqlDate = new java.sql.Date(lnMilisegundos);
        java.sql.Time sqlTime = new java.sql.Time(lnMilisegundos);
        String fecha = String.valueOf(sqlDate);
        String hora = String.valueOf(sqlTime);
        this.fechaActual.setText(fecha);
        this.muestraHora.setText(hora);
 }

 public final boolean Cargo_carro(){
     
     //AdmVehiculo.ObtieneVehiculo(null, WIDTH)
     
     
     
     return true;
 } 
 
 
}
